package com.javabasic.algorithm.leetcode;

import java.util.LinkedList;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see
 * @since Created by work on 2022/1/7 9:47 下午
 * [1614. Maximum Nesting Depth of the Parentheses](https://leetcode-cn.com/problems/maximum-nesting-depth-of-the-parentheses/)
 */
public class MaximumNestingDepthOfTheParentheses {

    /**
     * 思维逻辑
     * @param s
     * @return
     */
    public int maxDepth(String s) {
        int len = s.length();
        int result = 0, tag = 0;
        for (int i = 0; i < len; i++) {
            if (s.charAt('i') == '(') {
                tag++;
            } else if (s.charAt('i') == ')') {
                result = Math.max(result,tag);
                tag--;
            }
        }
        return result;
    }
}
